import {
  HIDE_LOADING,
  SHOW_LOADING,
  EDIT_BUSINESS,
  PITCHON_IMIG,
  PITCHON_IMIG_ID,
  INNIT_EDIT,
  UPLOAD_PIC,
  INIT_EDIT_BUSINESS,
  UPLOAD_HEAD_PIC,
  PITCH_HEAD_PIC,
  PITCH_HEAD_PIC_ID,
  GREETING_EDIT_INIT,
} from './type'

const state = {
  loading: false, //加载
  editBusiness: {}, //编辑名片
  pitchOnImg: '', //选中照片
  pitchOnImgId: '', //选中照片
  initEdit :true, //初始化编辑贺卡
  uploadPic :'', //上传贺卡图片
  initEditBusiness :true, //初始化名片编辑
  uploadHeadPic :'', //上传头像图片
  pitchHeadPic :'', //上传头像图片
  pitchHeadPicid :'', //上传头像图片id
  greetingEditInit :false, //贺卡编辑初始化
};

const mutations = {
  //隐藏加载
  [HIDE_LOADING](state) {
    state.loading = false;
  },
  //显示
  [SHOW_LOADING](state) {
    state.loading = true;
  },
  //编辑名片
  [EDIT_BUSINESS](state, editBusiness) {
    state.editBusiness = editBusiness;
  },
  //选中照片
  [PITCHON_IMIG](state, pitchOnImg) {
    state.pitchOnImg = pitchOnImg;
  },
  //选中照片ID
  [PITCHON_IMIG_ID](state, pitchOnImgId) {
    state.pitchOnImgId = pitchOnImgId;
  },
  //编辑贺卡初始化
  [INNIT_EDIT](state, initEdit) {
    state.initEdit = initEdit;
  },
  //上传贺卡图片
  [UPLOAD_PIC](state, uploadPic) {
    state.uploadPic = uploadPic;
  },
  //编辑名片初始化
  [INIT_EDIT_BUSINESS](state, initEditBusiness) {
    state.initEditBusiness = initEditBusiness;
  },
  //传递上传头像图片
  [UPLOAD_HEAD_PIC](state, uploadHeadPic) {
    state.uploadHeadPic = uploadHeadPic;
  },
  //上传头像图片
  [PITCH_HEAD_PIC](state, pitchHeadPic) {
    state.pitchHeadPic = pitchHeadPic;
  },
  //上传头像图片id
  [PITCH_HEAD_PIC_ID](state, pitchHeadPicid) {
    state.pitchHeadPicid = pitchHeadPicid;
  },
  //贺卡编辑初始化
  [GREETING_EDIT_INIT](state, greetingEditInit) {
    state.greetingEditInit = greetingEditInit;
  },
};

const getters = {
  //加载
  loading(state) {
    return state.loading;
  },
  //编辑名片
  editBusiness(state) {
    return state.editBusiness;
  },
  //选中照片
  pitchOnImg(state) {
    return state.pitchOnImg;
  },
  //选中照片
  pitchOnImgId(state) {
    return state.pitchOnImgId;
  },
  //编辑贺卡初始化
  initEdit(state) {
    return state.initEdit;
  },
  //上传贺卡图片
  uploadPic(state) {
    return state.uploadPic;
  },
  //编辑名片初始化
  initEditBusiness(state) {
    return state.initEditBusiness;
  },
  //上传头像图片
  uploadHeadPic(state) {
    return state.uploadHeadPic;
  },
  //上传头像图片截取
  pitchHeadPic(state) {
    return state.pitchHeadPic;
  },
  //上传头像图片id
  pitchHeadPicid(state) {
    return state.pitchHeadPicid;
  },
  //贺卡编辑初始化
  greetingEditInit(state) {
    return state.greetingEditInit;
  },
};

export default {
  state,
  mutations,
  getters
}
